<template>
	<el-button
		:title="text"
		v-if="!isloading"
		@click="onclick"
		:loading="isloading"
		type="primary"
		size="mini"
		>{{ text }}</el-button
	>
	<el-button
		:title="'采集中' + text"
		v-else
		@click="onclick"
		:loading="isloading"
		type="primary"
		size="mini"
		>采集中{{ text }}</el-button
	>
</template>
<script>
export default {
	data() {
		return {
			text: '采集历史订单',
			isloading: false
		};
	},
	methods: {
		onclick() {
			this.$emit('click');
		},
		start() {
			let self = this;
			this.text = 60;
			this.isloading = true;
			let timer = setInterval(() => {
				if (this.text == 0) {
					clearInterval(timer);
					this.end();
					return;
				}
				self.text -= 1;
			}, 1000);
		},
		end() {
			this.text = '采集历史订单';
			this.isloading = false;
		}
	}
};
</script>
<style lang="stylus" scoped>
>>>.el-button {
  padding: 4px 10px;
}
</style>
